//deque 随机访问
#include <iostream>
#include <deque>
using namespace std;

void printDeque(const deque<int> &d)
{
    for(auto &i:d)
    {
        cout<<i<<" ";
    }
    cout<<endl;
}

int main()
{
    deque<int> d({9,8,5,2,1,1});
    cout<<"d:";
    printDeque(d);

    cout<<"d[2]:"<<d[2]<<endl;
    cout<<"d.at(2):"<<d.at(2)<<endl;

    cout<<"d[10]:"<<d[10]<<endl;
    //cout<<"d.at(10):"<<d.at(10)<<endl;//系统会抛出段错误

    return 0;
}